var maxProduction = function(nums){
  if(nums.length === 0) return [];
  const maxProduct = [];
  const minProduct = [];
  maxProduct = nums[0];
  minProduct = nums[0];
  let max = nums[0];
  for(let i = 0 ; i < nums.length ; i++){
    maxProduct[i] = Math.max(nums[i] , nums[i]*maxProduct[i-1] , nums[i] *minProduct[i-1]);
    minProduct[i] = Math.min(nums[i],nums[i]*maxProduct[i-1],nums[i]*minProduct[i-1]);
    max = Math.max[max,maxProduct[i]];
  }
  return max;
}